<?php
namespace app\api\controller;
use app\common\controller\Api;
use app\admin\model\Report as ReportModel;
use think\Db;

class Report extends Api
{
    protected $noNeedRight = '*';

    public function _initialize()
    {
        parent::_initialize();
    }

    public function list(){
        $orderId = $this->request->get("order_id");
        $list = (new ReportModel())->where("order_id", $orderId)->select();
        $this->success("success",$list);
    }
    public function all(){
        $list = Db::table("zwa_report")->alias("r")
            ->join(['zwa_order'=>'o'],'r.order_id=o.id')
            ->field('r.*, o.order_no,o.name as order_name')
            ->where("o.user_id", $this->auth->getUser()->id)
            ->order("o.id", "desc")
            ->select();
        $this->success("msg", $list);
    }
}
